import { defHttp } from '/@/utils/http/axios';

enum Api {
  list = '/uav/device/query',
  edit = '/uav/device/save',
  live = '/uav/device/live/start',
  delDevice = '/uav/device/del/',
  UserList = '/sys/user/list',
  shadowGet = '/uav/device/shadow/get/',
  executeInstruct = '/uav/device/debug/instruct/post',
  //告警日志
  alarmQuery = '/uav/device/alarm/query',

  //轨迹回放
  trackQuery = '/uav/device/track/query',
  trackGet = '/uav/device/track/get',
  trackGetContent = '/uav/device/track/trackFileContent'
}

export const deviceApi = {
  list: (params) => defHttp.get({ url: Api.list, params }),
  edit: (params) => defHttp.post({ url: Api.edit, params }),
  del: (params) => defHttp.post({ url: Api.delDevice + params }),
  getShadow: (params) => defHttp.get({ url: Api.shadowGet + params }),
  executeInstruct: (params) => defHttp.post({ url: Api.executeInstruct, params }),
  getLiveUrl: (params) => defHttp.post({ url: Api.live, params })
};

export const UserList = () => defHttp.get({ url: Api.UserList });

export const alermLogApi = {
  query: (params) => defHttp.post({ url: Api.alarmQuery, params })
};

export const trackApi = {
  query: (params) => defHttp.get({ url: Api.trackQuery, params }),
  get: (params) => defHttp.get({ url: Api.trackGet, params }),
  getContent: (params) => defHttp.get({ url: Api.trackGetContent, params }),
};
